package fi.jamk.ourcookingapp.backend.architecture.interfaces;

import java.util.List;
import java.util.concurrent.ExecutionException;

import org.json.JSONException;

import fi.jamk.ourcookingapp.backend.exceptions.EmptyInputException;
import fi.jamk.ourcookingapp.backend.exceptions.NoUserException;
import fi.jamk.ourcookingapp.backend.exceptions.WebServiceException;
import fi.jamk.ourcookingapp.backend.model.User;

/**
 * Manager for handling actions for user services
 * @author Marius
 */
public interface IUserManager {

	/**
	 * Creates a new user
	 * @param user
	 * @return created user
	 * @throws InterruptedException
	 * @throws ExecutionException
	 * @throws JSONException
	 * @throws WebServiceException
	 * @throws EmptyInputException 
	 */
	public User createUser(User user) throws InterruptedException, ExecutionException, JSONException, WebServiceException, EmptyInputException;
	
	/**
	 * Adds the userToAdd to the users friend list
	 * @param user
	 * @param userToAdd
	 * @return boolean added
	 * @throws InterruptedException
	 * @throws ExecutionException
	 * @throws JSONException
	 * @throws NoUserException 
	 * @throws EmptyInputException 
	 */
	public boolean addToFriendList(User user, User userToAdd) throws InterruptedException, ExecutionException, JSONException, EmptyInputException, NoUserException;
	
	/**
	 * Login the user to the system.
	 * @param user
	 * @return loggedin user
	 * @throws InterruptedException
	 * @throws ExecutionException
	 * @throws JSONException
	 * @throws WebServiceException
	 * @throws EmptyInputException 
	 */
	public User login(User user) throws InterruptedException, ExecutionException, JSONException, WebServiceException, EmptyInputException;

	/**
	 * Retrieves the list of friends from the given user
	 * @param user
	 * @return List<User> result
	 * @throws InterruptedException
	 * @throws ExecutionException
	 * @throws JSONException
	 * @throws NoUserException 
	 */
	public List<User> friendList(User user) throws InterruptedException, ExecutionException, JSONException, NoUserException;
}
